package binary;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class FileBinary {
	private String hoTen;
	private Date ngaySinh;
	private String queQuan;
	
	//nhap thong tin
	public void nhapThongTin() {
		Scanner s = new Scanner(System.in);
		
		System.out.print("Ho ten: ");
		do {
			hoTen = s.nextLine();
		} while(hoTen.trim().isEmpty() || hoTen == "" || hoTen == null);
		setHoTen(hoTen);
		
		System.out.print("Ngay thang nam sinh: ");
		String ns;
		do {
			ns = s.nextLine();
		} while(ns.trim().isEmpty() || ns == "" || ns == null);
		ngaySinh = formatDate(ns);
		System.out.print(ngaySinh);
		
	}
	
	//ham format date
	public Date formatDate(String date) {
		Scanner s = new Scanner(System.in);
		DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
		
		try {
			ngaySinh = df.parse(date);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		return ngaySinh;
	}
	public String getHoTen() {
		return hoTen;
	}
	public void setHoTen(String hoTen) {
		this.hoTen = hoTen;
	}
	public Date getNgaySinh() {
		return ngaySinh;
	}
	public void setNgaySinh(Date ngaySinh) {
		this.ngaySinh = ngaySinh;
	}
	public String getQueQuan() {
		return queQuan;
	}
	public void setQueQuan(String queQuan) {
		this.queQuan = queQuan;
	}
	
	
	

}
